import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import router from './router'
import Rem from './utils/setPage10Rem'
import MyJs from "./utils/function"
import "bootstrap/dist/css/bootstrap.css"
import "font-awesome/css/font-awesome.css"
import "@/assets/common.css"
import commonJs from "./js/common"
Vue.use(commonJs)
import btn1 from "@/components/buttons/btn1.vue"
import followbtn from "@/components/buttons/followbtn.vue"
import AlertBottom from "@/components/tips/AlertBottom.vue"
import Alert from "@/components/tips/Alert.vue"
import ConfirmBottom from "@/components/tips/ConfirmBottom.vue"
import VueLazyload from 'vue-lazyload'
import BeiAn from '@/components/BeiAn.vue'
Vue.use(VueLazyload,{
  error:"https://topart.cn/Public/images/nopic.jpg"
})
Vue.component("btndefault",btn1)
Vue.component("followbtn",followbtn)
Vue.component("AlertBottom",AlertBottom)
Vue.component("Alert",Alert)
Vue.component("ConfirmBottom",ConfirmBottom)
Vue.component('beian',BeiAn)
Vue.config.productionTip = false
Vue.prototype.MyJs = MyJs

import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
  state: {
    domain: "https://topart.cn",
    userinfo:[]
  },
  getters:{
    getDomain(state){
      return state.domain
    },
    getUserinfo(state){
      return state.userinfo
    }
  },
  mutations: {
    setUserinfo(state,data){
      state.userinfo = data
    }
  }
})
router.afterEach((to, from) => {
  let userName=store.getters.getUserinfo.username
  if (to.meta.title&&userName) {
    document.title = to.meta.title+'-'+userName+'的个人官网'
  }
})
var app=new Vue({
  el: '#app',
  router,
  store,
  domain:"https://topart.cn",
  components: { App },
  template: '<App/>'
})
Rem.remset()
